package com.sixth.core.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @program: sixth-hospital-parent
 * @description:
 * @author: 李劲锋
 * @create: 2024-08-12 16:50
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class R<T>{
    private Integer code;
    private String msg;
    private T data;
    public static <T> R<T> ok(T data){
        R<T> r = new R<>();
        r.setCode(200);
        r.setData(data);
        r.setMsg("操作成功");
        return r;
    }
    public static <T> R<T> ok(){
        R<T> r = new R<>();
        r.setCode(200);
        r.setMsg("操作成功");
        return r;
    }

    public static <T> R<T> error(String msg){
        R<T> r = new R<>();
        r.setCode(500);
        r.setMsg(msg);
        return r;
    }
}
